{
    let a,b,rest;
    //数组赋值
   [a,b] = [1,2];
   console.log(a,b);
}
{
    let a,b,rest;
    [a,b,...rest]=[1,2,3,4,5,6];
    console.log(a,b,rest);
}
//对象
{
    let a,b;
    ({a,b} = {a:1,b:2})
    console.log(a,b);
}

//只声明没有赋值
{
    let a,b,c,rest;
    //数组赋值
   [a,b] = [1,2];
   console.log(a,b,c);
}

//变换
{
    let  a = 1;
    let b=2;
    [a,b] = [b,a]
    console.log(a,b);
}

{
    function f(){
        return [1,2]
    }
    let a,b;
    [a,b]=f();
    console.log(a,b);
}
//只要需要的值
{
    function f(){
        return [1,2,3,4,5]
    }
    let a,b,c;
    [a,,,b] = f();
    console.log(a,b);

}
//只需要第一个，其他的都是数组
{
    function f(){
        return [1,2,3,4,5]
    }
    let a,b,c;
    [a,...b] = f();
    console.log(a,b);

}

//对象,两边都是对象的形式
{
    let o = {p:42,q:true};
    let {p,q} = o;
    console.log(p,q);
}
//默认值
{
    let {a=10,b=5}={a:3};
    console.log(a,b);
    //3，5
}

{
    let metaData={
        title:'abc',
        test:[{
            title:'test',
            desc:'desc12'
        }]
    }

    let {title:estest,test:[{title:cntitle}]} = metaData;
    console.log(estest,cntitle);
}